<?php
	header("content-type:text/html;charset=utf-8");
	$uname=$_POST["uname"];
	$upwd=$_POST["upwd"];
	$db=mysqli_connect("localhost","root","","flower");
	mysqli_query($db,"set names utf8");
	$sql = "select * from user where uname = '$uname'";
	$resault = mysqli_query($db,$sql);
	
	$row = mysqli_fetch_array($resault);
	
	if($row){
		echo "ok";
	}else{
		$psql = "insert into user (uname,upwd) values ('$uname','$upwd')";
		$res = mysqli_query($db,$psql);
		if($res){
			echo $uname;//注册成功
		}else{
			echo "no";//2代表注册失败
		}
	}
?>